<%@page language="java" import="com.scalar.chiptrack.sales.SalesOrderInvoice,
                                com.scalar.chiptrack.users.User,
                                com.scalar.chiptrack.users.Functionality" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>

<%@ page import="com.scalar.chiptrack.utils.ConfigManager"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML>
<HEAD><TITLE>Scalarsoft - ChipTrac</TITLE>

<%String chipTracContext = "/" + ConfigManager.getChipTracContext();%>

<chiptrack:checkLogon sourcePage="/jsp/finance/sales_order_invoice_search.jsp"/>

<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type=text/css rel=stylesheet>

<SCRIPT language="JavaScript">
function submit()
{
    //document.salesOrderInvoiceForm.submit();
    return true;
}
function reset()
{
    document.salesOrderInvoiceForm.reset();
}
function addInvoice()
{
    document.salesOrderInvoiceForm.action='<%=chipTracContext%>/salesOrderInvoice.do?action=new';
    document.salesOrderInvoiceForm.submit();
}
function viewInvoice( ivcNumber )
{
   document.salesOrderInvoiceForm.action=" <%=chipTracContext%>/salesOrderInvoice.do?action=view&invoiceNumber="+ivcNumber;
   document.salesOrderInvoiceForm.submit();
}

function deleteInvoice( ivcNumber )
{
   document.salesOrderInvoiceForm.action=" <%=chipTracContext%>/salesOrderInvoice.do?action=view&flag=true&invoiceNumber="+ivcNumber;
   document.salesOrderInvoiceForm.submit();
}
function packingSlipInvoice()
{
   //document.salesOrderInvoiceForm.action=" <%=chipTracContext%>/salesOrderInvoice.do?action=packingSlipInvoiceSearch";
   document.salesOrderInvoiceForm.action=" <%=chipTracContext%>/jsp/sales/sales_order_invoice_packing_slip_search.jsp";
   document.salesOrderInvoiceForm.submit();
}

</SCRIPT>

</HEAD>
<BODY bgColor=#ffffff leftMargin=0 topMargin=0 marginheight="0" marginwidth="0">
<!-- Top Header Start-->

<%@include file="/jsp/includes/header.jsp"  %>

<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
  <TBODY>
    <TR>
	    <TD width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>

<!-- Side Navigation start -->

<%@include file="/jsp/sales/sales_menu.jsp" %>

        </TD>
<!-- end of the side navigations -->

        <TD bgcolor="#ffffff">
            <IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8>
        </TD>
        <TD bgcolor="#ffffff">
            <IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2>
        </TD>
        <TD valign="top" width="100%">

        <!-- SiteMap Tag -->
        <!-- chiptrack:sitemap styleClass="NArialS"/ -->

    <chiptrack:permission functionality='<%=Functionality.SALES_ORDER_INVOICE%>'
        action='<%=User.USER_ACTION_VIEW%>' styleClass="NArialL" >
    </chiptrack:permission>

            <IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0>
<BR>

<!-- from here your body starts -->
<P>
    <TABLE BORDER="0" WIDTH="100%">
        <html:form name="salesOrderInvoiceForm" action="/salesOrderInvoice.do?action=search" method="post" type="com.scalar.chiptrack.sales.forms.SalesOrderInvoiceForm" onsubmit="javascript:return submit()">
        <TR>
            <TD WIDTH="100%" class="NArialW"><P ALIGN="CENTER">Sales Invoice Search
            </TD>
        </TR>
        <TR>
            <TD WIDTH="100%">&nbsp;</TD>
        </TR>
        <TR>
            <TD><chiptrack:info styleClass="NArialL" /></TD>
        </TR>
        <TR>
            <TD><chiptrack:errors styleClass="NArialL" /></TD>
        </TR>
        <TR>
            <TD><chiptrack:moreErrorInfo styleClass="NArialL" /></TD>
        </TR>
        <TR>
	        <TD WIDTH="100%">
                <TABLE BORDER="0" WIDTH="100%">
				<TR>
					<TD WIDTH="100%">

                <nested:nest property="salesOrderInvoice">
						<TABLE BORDER="0" WIDTH="100%" CLASS="NArialL">
							<TR>
								<TD WIDTH="7%">&nbsp;</TD>
								<TD WIDTH="10%">Document&nbsp;Number:</TD>
								<TD WIDTH="1%">&nbsp;</TD>
								<TD WIDTH="22%">
                                    <html:text property="invoiceNumber" styleClass="txfield" size="25" maxlength="21"/>
                                </TD>
								<TD WIDTH="1%">&nbsp;</TD>
								<TD WIDTH="5%">Doc&nbsp;Type:</TD>
								<TD WIDTH="1%">&nbsp;</TD>
								<TD WIDTH="45%">

							<html:select property="invoiceDocumentTypeId" styleClass="txfield" >
                                        <html:option value="0" >----- All -----</html:option>
                                        <html:options collection = "documentType" property="value" labelProperty="label"/>
                            </html:select>
								</TD>
								<TD WIDTH="8%">&nbsp;</TD>
							</TR>
							<TR>
								<TD WIDTH="7%">&nbsp;</TD>
								<TD WIDTH="13%">Customer Name:</TD>
								<TD WIDTH="1%">&nbsp;</TD>
								<TD WIDTH="22%">
                                <html:text property="customerName" styleClass="txfield" size="25" maxlength="65"/>
                                </TD>
                                <TD WIDTH="1%">&nbsp;</TD>
								<TD WIDTH="5%">Year:</TD>
								<TD WIDTH="1%">&nbsp;</TD>
								<TD WIDTH="45%">

                                    <html:select property="year" styleClass="txfield" >
                                                <html:option value="" >--select--</html:option>
                                                <html:options collection = "YearList" property="value" labelProperty="label"/>
                                    </html:select>
								</TD>
								<TD WIDTH="8%">&nbsp;</TD>
							</TR>
							<TR>
								<TD COLSPAN="9">&nbsp;</TD>
							</TR>
						</TABLE>
					</TD>
				</TR>
				<TR>
					<TD WIDTH="100%">
						<TABLE BORDER="0" WIDTH="90%" CLASS="NArialL" align="center">
							<TR>
								<TD COLSPAN="2"><P ALIGN="RIGHT">
                                <%--<A href="javascript:submit();" onmouseover="window.status='Click here to go Search for Sales Order Invoices';return true" onmouseout="window.status='';return true"><IMG SRC="<%=chipTracContext%>/jsp/includes/images/search.gif" ALIGN="BOTTOM" BORDER="0" ></a> --%>
                                <input type=image border="0" src="<%=chipTracContext%>/jsp/includes/images/search.gif" width="53" height="17" onmouseover="window.status='Click here to go Search for Sales Order Invoices';return true" onmouseout="window.status='';return true" title="Click here to Search for Sales Order Invoices"/>
                                </TD>
								<TD WIDTH="47%"><A href="javascript:reset();" onmouseover="window.status='Click here to Reset';return true" onmouseout="window.status='';return true"><IMG SRC="<%=chipTracContext%>/jsp/includes/images/reset.gif" ALIGN="BOTTOM" BORDER="0"></A></TD>
							</TR>
							<TR>
								<TD COLSPAN="2">&nbsp;</TD>
								<TD WIDTH="47%">&nbsp;</TD>
							</TR>
							<TR>
                                <TD COLSPAN="2">&nbsp;</TD>
								<!-- TD COLSPAN="2">To add a new Sales Invoice, Please
                                   <!-- chiptrack: restrictedLink functionality="< %=Functionality.SALES_ORDER_INVOICE %>"
                                      action="< %=User.USER_ACTION_MODIFY %>"href="javascript:addInvoice();" onmouseover="window.status='Click here to add Sales Invoice';return true" onmouseout="window.status='';return true">Click Here
                                   < /chiptrack: restrictedLink ></TD -->
								<TD WIDTH="47%">&nbsp;</TD>
							</TR>
                            <!-- Added by rohan on March 31 2004-->
                            <TR>
								<TD COLSPAN="3">To create a Sales Invoice using Packing Slip data, Please
                                   <chiptrack:restrictedLink functionality="<%=Functionality.SALES_ORDER_INVOICE%>"
                                      action="<%=User.USER_ACTION_MODIFY%>"href="javascript:packingSlipInvoice();" onmouseover="window.status='Click here to create Sales Invoice using Packing Slip data';return true" onmouseout="window.status='';return true">Click Here
                                   </chiptrack:restrictedLink></TD>
							</TR>
                            <!-- End of additions by rohan on March 31 2004-->
							<TR>
								<TD WIDTH="49%">&nbsp;</TD>
								<TD WIDTH="4%">&nbsp;</TD>
								<TD WIDTH="47%">&nbsp;</TD>
							</TR>
						</TABLE>
					</TD>
				</TR>

            <logic:present name="salesOrderInvoiceList">
				<TR>
						<TABLE BORDER="0" WIDTH="90%" CLASS="NArialL" align="center">
							<TR>
								<TD WIDTH="20%" BGCOLOR="#993333">
									<P ALIGN="CENTER"><FONT COLOR="white">Invoice Number</FONT>
								</TD>
								<TD WIDTH="40%" BGCOLOR="#993333">
									<P ALIGN="CENTER"><FONT COLOR="white">Customer Name</FONT>
								</TD>
                                <TD WIDTH="10%" BGCOLOR="#993333">
									<P ALIGN="CENTER"><FONT COLOR="white">Doc Type</FONT>
								</TD>
                                <TD WIDTH="30%" BGCOLOR="#993333">
									<P ALIGN="CENTER"><FONT COLOR="white">Action</FONT>
								</TD>
							</TR>
                            <logic:iterate id="SalesOrderInvoice" name="salesOrderInvoiceList" indexId="index">
                                <TR <% if( Integer.parseInt( index.toString() ) % 2 == 0 ){ %> bgcolor='#DEE1E2' <% } else {%> bgcolor='#FFFFEE' <%}%> >
                                    <TD>
                                        <P ALIGN="LEFT">
                                        &nbsp;&nbsp;<bean:write name="SalesOrderInvoice" property="invoiceNumber" />
                                    </TD>
                                    <TD nowrap>
                                        <P ALIGN="LEFT">
                                         &nbsp;&nbsp;<bean:write name = "SalesOrderInvoice" property="customerName"/>
                                    </TD>
                                    <TD>
                                        <P ALIGN="LEFT">
                                        &nbsp;&nbsp;<bean:write name = "SalesOrderInvoice" property="invoiceDocumentTypeIdLabel"/>
                                    </TD>
                                    <TD>
                                        <P ALIGN="CENTER">
                                        <chiptrack:restrictedLink functionality="<%=Functionality.SALES_ORDER_INVOICE%>"
                                            action="<%=User.USER_ACTION_VIEW%>"
                                            href='<%="javascript:viewInvoice(\'" +
                                            ( ( SalesOrderInvoice )SalesOrderInvoice ).getEncodedSalesInvoiceNumber() +"\');" %>' onmouseover="window.status='Click here To View Sales Order Invocie Details';return true" onmouseout="window.status='';return true">
                                            View
                                        </chiptrack:restrictedLink>
                                        &nbsp;&nbsp;&nbsp;
                                        <a href="<%= chipTracContext %>/salesOrderInvoice.do?action=edit&invoiceNumber=<bean:write name = "SalesOrderInvoice" property="encodedSalesInvoiceNumber"/>" onmouseover="window.status='Click here To Modify Sales Order Invoice Details';return true" onmouseout="window.status='';return true">Modify</a>
                                        &nbsp;&nbsp;&nbsp;
                                        <chiptrack:restrictedLink functionality="<%=Functionality.SALES_ORDER_INVOICE%>"
                                            action="<%=User.USER_ACTION_VIEW%>"
                                            href='<%="javascript:deleteInvoice(\'" +
                                            ( ( SalesOrderInvoice )SalesOrderInvoice ).getEncodedSalesInvoiceNumber() +"\');" %>' onmouseover="window.status='Click here To Delete Sales Order Invocie Details';return true" onmouseout="window.status='';return true">
                                           Delete
                                        </chiptrack:restrictedLink>
                                    </TD>
                                </TR>
                            </logic:iterate>
            			</TABLE>
				</TR>
            </logic:present>
        </nested:nest>
    </html:form>
			</TABLE>
</TR>
</TABLE>

</TD>
</TR>
</TABLE>
<!-- Your Work area ends here -->
<!-- Footer starts here -->
<%@include file="/jsp/includes/footer.jsp" %>
<!-- footer end here -->
</BODY>
</html>


